forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop polyfilling Promise (facebook/react-native#29754) #5
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Following RN's instructions [1]. To build them, we used the recommended Docker command: ``` docker run --rm --name rn-build -v $PWD:/pwd -w /pwd \ reactnativecommunity/react-native-android /bin/sh -c \ "./gradlew installArchives" ``` We might have chosen to put the binaries in Maven instead of in the repository, but that seemed unnecessarily complicated [2]. [1] https://github.com/facebook/react-native/wiki/Building-from-source#publish-your-own-version-of-react-native [2] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.60react-native.60.20fork/near/984529
It looks like this line was introduced in 3ff3987, in 2015, and it has remained in a similar form since then. I haven't found any explanation for it. At jestjs/jest#10221 [1], a core Jest maintainer says, """ As an aside, one should never replace `global.Promise` [...]. E.g. when using `async-await` you will always get the native `Promise` regardless of the value of `global.Promise`. """ jestjs/jest#10221 is one issue this line has raised, for anyone using the latest features of Jest to test async code in their React Native projects. [1] jestjs/jest#10221 (comment) Fixes: facebook#29303
Closing, as we've found an easier strategy (both mentioned by Greg on a video call, and pointed out in a helpful comment jestjs/jest#10221 (comment)). |
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
Oct 27, 2020
This is much easier and less invasive than forking React Native, as we considered in zulip/react-native#5. The idea comes from Greg on a video call, with a code example provided by a @testing-library/react-native contributor [1]. Follow that example, with tweaks for our project -- using camelCase for the file names, putting the new files in our `jest` directory, and adding a TODO mentioning that we'd maybe like to get back to using jest-expo, which wraps React Native's preset. [1] jestjs/jest#10221 (comment), which links to sbalay/without_await@64a76486f.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
Jan 11, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. The idea comes from Greg on a video call, with a code example provided by a @testing-library/react-native contributor [1]. Follow that example, with tweaks for our project -- using camelCase for the file names, putting the new files in our `jest` directory, and adding a TODO mentioning that we'd maybe like to get back to using jest-expo, which wraps React Native's preset. [1] jestjs/jest#10221 (comment), which links to sbalay/without_await@64a76486f.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
Feb 8, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. The idea comes from Greg on a video call, with a code example provided by a @testing-library/react-native contributor [1]. Follow that example, with tweaks for our project -- using camelCase for the file names, putting the new files in our `jest` directory, and adding a TODO mentioning that we'd maybe like to get back to using jest-expo, which wraps React Native's preset. [1] jestjs/jest#10221 (comment), which links to sbalay/without_await@64a76486f.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
Apr 13, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. The idea comes from Greg on a video call, with a code example provided by a @testing-library/react-native contributor [1]. Follow that example, with tweaks for our project -- using camelCase for the file names, putting the new files in our `jest` directory, and adding a TODO mentioning that we'd maybe like to get back to using jest-expo, which wraps React Native's preset. [1] jestjs/jest#10221 (comment), which links to sbalay/without_await@64a76486f.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
Apr 13, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. The idea comes from Greg on a video call, with a code example provided by a @testing-library/react-native contributor [1]. Follow that example, with tweaks for our project -- using camelCase for the file names, putting the new files in our `jest` directory, and adding a TODO mentioning that we'd maybe like to get back to using jest-expo, which wraps React Native's preset. [1] jestjs/jest#10221 (comment), which links to sbalay/without_await@64a76486f.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
May 19, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. See jestjs/jest#10221 (comment).
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
May 20, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. See jestjs/jest#10221 (comment).
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this pull request
May 21, 2021
This is much easier than forking React Native, as we considered in zulip/react-native#5. See jestjs/jest#10221 (comment).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've opened facebook#29754 so that this change could eventually land in React Native officially. Note that the
facebook/react-native
test suite shows failures, there and here (yarn && yarn test
), related to Promises. I hope a React Native maintainer will help us figure out what to do about them. Still, it seems to work for our purposes.This should solve jestjs/jest#10221, letting us use the "modern" implementation of fake timers in Jest.
Since we haven't yet actually used our fork of React Native as our
react-native
dependency, here are a few notes:To get them included, I just tweaked the
.gitignore
to not ignore/android/
, as indicated in the instructions (for having the binary live in the repo)No changes to our app project were necessary, beyond pointing the
package.json
to the appropriate commit on GitHubWhen identifying a commit in
package.json
with something other than a commit ID, as in"react-native": "zulip/react-native#0.61.5-zulip"
(the "0.61.5-zulip" branch on our fork), we do have to be careful about Yarn caching the code. If the branch changes, it seems that one needs to runyarn cache clean react-native
to get the most up-to-date code from the branch upon runningyarn
.